<template>
  <div>
    <File :file="file" :files="files" :index="index"></File>
    <el-button type="danger" @click="deleteFile(index)" plain size="mini">删除文件</el-button>
  </div>
</template>
<script>
  import File from "@/components/File"

  export default {
    name: "fileEdit",
    props:["files","index","file","deleteItem"],
    components:{File},
    data(){
      return {
      }
    },
    methods: {
      deleteFile(index) {
        console.log(index);
        if (this.files[index].oldname !== undefined) {
          this.deleteItem.push(this.files[index].oldname);
          console.log(this.deleteItem);
        }
        this.files.splice(index, 1);
      }
    }
  }
</script>
<style scoped></style>
